<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/jsp/taglib.jsp"%>
<%@page import="com.framework.utils.ConfigUtil"%>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>信息编辑窗体</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

   <link href="${ctxStatic}/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <%--<link href="${ctxStatic}/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">--%>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/plugins/h+/css/plugins/webuploader/webuploader.css">
    <link href="${ctxStatic}/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">

<style>
    .dtupload>img{
        width: 54px;
        padding-left: 39px;
        padding-top: 16px;
    }
    .dtupload>a{
        color: #268eff;
        font-size: 12px;
        position: relative;
        left: 26px;
        top: 10px;
    }.dtupload>a:hover,
     .shoplogo>a:hover{
         color:#F93;
     }.upload_pic {
          height: 70px;
          width:70px;
          position: relative;
          cursor: pointer;
          color: #ccbe9e;
          background: #fff;
          overflow: hidden;
          display: inline-block;
          *display: inline;
          *zoom: 1;
      }
    .upload_pic input {
        position: absolute;
        height:100%;
        width:100%;
        right: 0;
        top: 0;
        opacity: 0;
        filter: alpha(opacity=0);
        cursor: pointer
    }
    .upload_pic:hover {
        color: #ccbe9e;
        background: #fff;
        text-decoration: none
    }
    ul,li{
        list-style:none;
    }
    .minussapn,.plussapn{
        cursor:pointer;
        font-size:20px;
        color:#ff503e;
        margin-left:10px;
    }
    .newplussapn{
        font-size:16px;
        margin-left:10px;
        color:#fff;
        display:inline-block;
        padding:0 5px;
        border-radius:4px;
        background-color:#0f91d3;
        cursor:pointer;
    }
    .span-add{
        color:#0f91d3;
        cursor:pointer;
    }
    .picsup{
        margin:10px 0;
        display:none;
    }
    .addpicsul{
        padding:0;
    }
    .addpicsul li{
        float:left;
        height:80px;
        width:80px;
        margin:5px;
        position:relative;
    }
    .posminus{
        position: absolute;
        right: -5px;
        top: 0;
        /* font-size: 50px; */
    }
    .picsplus{
        margin-top:30px;
    }
    .imgpics{
        height:80px;
        width:80px;
    }
    .minesel{
        float:left;
        width:120px;
        margin-right:5px;
    }
    .secdsel{
        padding:0;
    }
    .secdsel li{
        float:left;
        position:relative;
    }
    .posminus-sel{
        position: absolute;
        top: 0;
        right: -0px;
        /* color: #fff; */
        border-radius: 100%;
        /* background-color: #f00; */
        z-index: 2;
        /* padding: 0 2px; */
        /* font-size: 50px; */
    }
    .posdelall{
        position: absolute;
        right: -0px;
        top: 0px;
        /* font-size: 50px; */
    }
    .onecup{
        float: left;
        position:relative;
        display: inline-block;
    }
    .oowninputwd{
        width:80px;
    }
    .level_2_a{
        padding-left:20px;
    }input.searchinput{
         width:200px;
         display: inline-block;
         margin-right: 15px;
     }
    .modaltable{
        width:100%;
        border:1px solid #ddd;
        border-right: 0;
        border-bottom: 0;
        margin-top: 10px;
    }
    .modaltable thead tr th,
    .modaltable tbody tr td{
        padding:2px 0;
        text-align: center;
        border-right: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }
    .edui-default{
        /*z-index: 999!important;*/
    }
    .edui-default .edui-editor{
        z-index: 999!important;
    }


    /*减号显示隐藏*/
    .posminus-sel,.posdelall,.posminus{
        display:none;
    }
</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="panel-options">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="tabs_panels.html#tab-0"><i class="fa fa-laptop">商品信息</i></a>

            </li>
            <%--<li class=""><a data-toggle="tab" href="tabs_panels.html#tab-1"><i class="fa fa-desktop">支付配置</i></a>--%>
            <%--</li>--%>

        </ul>
    </div>

    <div class="panel-body">
        <form class="form-horizontal" onsubmit="return  false" id="form_brand">
            <input type="hidden" name="pwxgoods.id" value="${twxgoods.id}">
            <input type="hidden" id="hid_page_type" name="pwxgoods.page_type" value="${page_type}">
        <div class="tab-content">
            <div id="tab-0" class="tab-pane active">
                <div class="ibox-content">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品名：</label>
                            <div class="col-sm-9">
                                <input type="text" placeholder="" class="form-control" id="pwxgoods_name" name="pwxgoods.name" value="${twxgoods.name}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">封面图：</label>
                            <div class="col-sm-9">
                                <div class=" clear">
                                    <ul class="addpicsul" style="float:left;">
                                        <li>
                                            <a href="javascript:" class="upload_pic" style="height:80px;"><input type="file" name="fileToUpload" id="fileToUploadCover" onchange="uploadFile('fileToUploadCover','imgUpdateCover','shopPicIdCover');">
                                                <c:choose>
                                                    <c:when test="${not empty twxgoods.coverPath}">
                                                        <img id="imgUpdateCover" src="<%=ConfigUtil.get("OSSURL")%>/${twxgoods.coverPath}" width="100%">
                                                    </c:when>
                                                    <c:otherwise>
                                                        <img id="imgUpdateCover" src="http://9900oss.oss-cn-hangzhou.aliyuncs.com//common/plus_72.png" width="100%">
                                                    </c:otherwise>
                                                </c:choose>
                                                <input type="hidden" id="shopPicIdCover" name="pwxgoods.coverId" value="${twxgoods.coverId}">
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品图：</label>
                            <div class="col-sm-9">
                                <div class=" clear">
                                    <ul class="addpicsul picClass" style="float:left;">
                                <c:choose>
                                    <c:when test="${not empty piclist}">
                                        <c:forEach items="${piclist}" var="obj" varStatus="vs">
                                            <li>
                                                <a href="javascript:" class="upload_pic" style="height:80px;">
                                            <input type="file" class="fileInputO" name="fileToUpload"
                                                   id="fileToUpload${obj.id }"
                                                   onChange="uploadFile('fileToUpload${obj.id }','imgUpdate${obj.id }','shopPicId${obj.id }')"/>
                                            <img id="imgUpdate${obj.id }" src="<%=ConfigUtil.get("OSSURL")%>/${obj.path }" width="100%"/>
                                            <input type="hidden" name="pwxgoods.goodsPicId" value="${obj.id }" id="shopPicId${obj.id }"/>
                                                </a>
                                            </li>
                                        </c:forEach>
                                    </c:when>
                                    <c:otherwise>
                                        <li>
                                            <a href="javascript:" class="upload_pic" style="height:80px;"><input type="file" name="fileToUpload" id="fileToUpload1" onChange="uploadFile('fileToUpload1','imgUpdate1','shopPicId1');">
                                                <img  id="imgUpdate1" src="${OSSURL}/common/plus_72.png" width="100%"/>
                                                <input type="hidden" id="shopPicId1" name="pwxgoods.goodsPicId">
                                            </a>
                                            <i class="fa fa-minus-circle minussapn posminus" onclick="delpic(this);"></i>
                                        </li>
                                    </c:otherwise>
                                </c:choose>
                                    </ul>
                                    <i class="fa fa-plus-circle plussapn picsplus" onclick="picsplus();"></i>
                                </div>
                            </div>
                        </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">返积分比例：</label>
                        <div class="col-sm-3">
                            <input type="number" min="0" max="900" style="width:150px" placeholder="" class="form-control" id="pwxgoods_intPro" name="pwxgoods.intPro" value="${twxgoods.intPro}">
                        </div>
                        <div class="col-sm-1"><span style="font-size: 14px">%</span></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商品类型：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_isTicket" name="pwxgoods.isTicket" data-placeholder="选择商品类型..." class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.isTicket}">
                                <option value="0">普通商品</option>
                                <option value="1">积分商品</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">是否推荐：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_isRecommend" name="pwxgoods.isRecommend" data-placeholder="请选择..." class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.isTicket}">
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">单位：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_unitId" name="pwxgoods.unitId" data-placeholder="选择单位..." class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.unitId}">

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分组：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_groupId" name="pwxgoods.groupId" data-placeholder="选择分组..." class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.groupId}">

                            </select>
                        </div>
                        <label class="col-sm-2 control-label">标签：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_tags" name="pwxgoods.tags" data-placeholder="选择标签..."  multiple  class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.tags}">

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">品牌：</label>
                        <div class="col-sm-4">
                            <select  id="pwxgoods_brand" name="pwxgoods.brand" data-placeholder="选择品牌..." class="chosen-select" style="width:100%" tabindex="1" value="${twxgoods.brand}">

                            </select>
                        </div>
                    </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">库存规格：</label>
                            <div class=" col-sm-9">
                                <div class="">
                                </div>
                              <div id="fisrtList">
                                <div class="singleobj" id="div_1" style="display: none;">
                                    <div class="level_1 clear" >
                                        <div class="onecup">
                                            <select class="form-control m-b minesel" name="account" onchange="showSecond(this.value,1)" id="groupList1">
                                            </select>
                                            <span class="fa fa-minus-circle minussapn delcurobj posdelall" onclick="delobj(1);"></span>
                                        </div>
                                        <%--<span class="newplussapn" onclick="addoption(1,0);">新增1</span>--%>
                                    </div>
                                    <div class="level_2 clear">
                                        <div class="level_2_a" style="float:left;">
                                            <ul class="secdsel"  id="addtwo1">
                                            </ul>
                                        </div>
                                        <span class="fa fa-plus-circle plussapn" onclick="addsel(1);"></span>
                                        <%--<span class="newplussapn" onclick="addoption(2,1)">新增</span>--%>
                                    </div>
                                </div>
                            </div>

                                <div id="singleobjplus">
                                    <div class="singleobj" id="div_2" style="display: none;">
                                        <div class="level_1 clear" >
                                            <div class="onecup">
                                                <select class="form-control m-b minesel" name="account" onchange="showSecond(this.value,2)" id="groupList2">
                                                </select>
                                                <span class="fa fa-minus-circle minussapn delcurobj posdelall" onclick="delobj(2);"></span>
                                            </div>
                                            <%--<span class="newplussapn" onclick="addoption(1,0);">新增2</span>--%>
                                        </div>
                                        <div class="level_2 clear">
                                            <div class="level_2_a" style="float:left;">
                                                <ul class="secdsel"  id="addtwo2">
                                                </ul>
                                            </div>
                                            <span class="fa fa-plus-circle plussapn" onclick="addsel(2);"></span>
                                            <%--<span class="newplussapn" onclick="addoption(2,2);">新增</span>--%>
                                        </div>
                                    </div>
                                    <div class="singleobj" id="div_3" style="display: none;">
                                        <div class="level_1 clear" >
                                            <div class="onecup">
                                                <select class="form-control m-b minesel" name="account" onchange="showSecond(this.value,3)" id="groupList3">
                                                </select>
                                                <span class="fa fa-minus-circle minussapn delcurobj posdelall" onclick="delobj(3);"></span>
                                            </div>
                                            <%--<span class="newplussapn" onclick="addoption(1,0);">新增3</span>--%>
                                        </div>
                                        <div class="level_2 clear">
                                            <div class="level_2_a" style="float:left;">
                                                <ul class="secdsel"  id="addtwo3">
                                                </ul>
                                            </div>
                                            <span class="fa fa-plus-circle plussapn" onclick="addsel(3);"></span>
                                            <%--<span class="newplussapn" onclick="addoption(2,3);">新增</span>--%>
                                        </div>
                                    </div>
                                </div>
                                <div class="addggxm">
                                    <span class="span-add" onclick="addobj();"><span class="fa fa-plus"></span>添加规格项目</span>
                                </div>
                                <table class="table" id="tableList">
                                    <thead><tr>
                                    <c:forEach items="${grouplist}" var="a">
                                        <th>${a.name}</th><input type="hidden" value="${a.id}">
                                    </c:forEach>
                                        <th>销售价(元)</th><th>进货价(元)</th><th>库存</th><th style="display: none">扫码编码</th></tr></thead>
                                    <tbody>
                                        <c:forEach items="${stockList }" var="s"  varStatus="a">
                                            <input type="hidden" value="${s.id}" name="pwxgoods.stockId">
                                            <input type="hidden" name="pwxgoods.stocklist[0].typesId1" value="${s.typesId1}"/>
                                            <input type="hidden" name="pwxgoods.stocklist[0].typesId2" value="${s.typesId2}"/>
                                            <input type="hidden" name="pwxgoods.stocklist[0].typesId3" value="${s.typesId3}"/>
                                        <tr>
                                            <c:if test="${not empty s.name && s.name!=''}">
                                                <td>${s.name}</td>
                                            </c:if>
                                            <c:if test="${not empty s.name1 && s.name1!=''}">
                                                <td>${s.name1}</td>
                                            </c:if>
                                            <c:if test="${not empty s.name2 && s.name2!=''}">
                                                <td>${s.name2}</td>
                                            </c:if>
                                            <td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist[0].price" value="${s.price}"></td>
                                            <td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist[0].netPrice" value="${s.netPrice}"></td>
                                            <td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist[0].stock" value="${s.stockNow}"></td>
                                            <td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist[0].venderId" value="${s.venderId}"></td>
                                        </tr>
                                        </c:forEach>
                                     </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品简介：</label>
                            <div class=" col-sm-9">
                                <input type="text" id="pwxgoods_infoLite"  name="pwxgoods.infoLite" value="${twxgoods.infoLite}"  placeholder="" class="form-control">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">内容：</label>
                            <div class=" col-sm-9">
                                <!-- 加载编辑器的容器 -->
                                <script id="container" name="content" style="height:300px" type="text/plain">
                                </script>
                                <input id="pwxgoods_info" name="pwxgoods.info" type="hidden">
                            </div>
                        </div>


                    <div class="form-group">
                        <div class="col-sm-offset-3 col-sm-8">
                            <button class="btn btn-primary" onclick="doSubmit();">提交</button>
                            <button id="btn_close1"  class="btn btn-primary" type="button">关闭</button>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        </form>

        </div>
</div>
<div class="modal inmodal" id="myModal4" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <span style="font-size:18px;">新增属性</span>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
                <div><input type="text" class="form-control" id="groupName"/></div>
                <input type="hidden" id="groupPid">
                <input type="hidden" id="groupType">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="closemodal();">保存</button>
            </div>
        </div>
    </div>
</div>

<div class="modal inmodal" id="myModa" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <span style="font-size:18px;">商户列表</span>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
                <div class="text-right">
                    <label>商户姓名：</label>
                    <input type="text" class="form-control searchinput" id="venderName"/>
                    <button type="button" class="btn btn-primary" onclick="showVenderId()">搜索</button>
                </div>
                <div class="">
                    <table class="modaltable">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>手机号</th>
                            <th>地址</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="venderIdList">
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

</body>
    <script src="${ctxStatic}/plugins/h+/js/jquery.min.js?v=2.1.4"></script>

<!-- 配置文件 -->
<%--<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/utf8-jsp/ueditor.config.js"></script>--%>
<!-- 编辑器源码文件 -->
<%--<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/utf8-jsp/ueditor.all.js"></script>--%>
    <script src="${ctxStatic}/plugins/h+/js/content.min.js?v=1.0.0"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/demo/form-validate-demo.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/layer2.4/layer.js"></script>

    <script src="${ctxStatic}/plugins/h+/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="${ctxStatic}/plugins/h+/js/content.min.js?v=1.0.0"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/chosen/chosen.jquery.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/jsKnob/jquery.knob.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/jasny/jasny-bootstrap.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/nouslider/jquery.nouislider.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/switchery/switchery.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/ionRangeSlider/ion.rangeSlider.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/iCheck/icheck.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/clockpicker/clockpicker.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/cropper/cropper.min.js"></script>
    <script src="${ctxStatic}/plugins/h+/js/demo/form-advanced-demo.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/ajaxfileupload.js"></script>

<script src="${pageContext.request.contextPath}/resources/plugins/ueditor1_4_2-utf8-jsp/ueditor.config.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/ueditor1_4_2-utf8-jsp/ueditor.all.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/ueditor1_4_2-utf8-jsp/lang/zh-cn/zh-cn.js"></script>





<script>
    var count = 0;
    var plussin="";
    var html1="";
    var html2="";
    var html3="";
    var array1=new Array();
    var array2=new Array();
    var array3=new Array();
    if(${fn:length(grouplist)!=0}){
        count=${fn:length(grouplist)};
    }
    var propertyList=jQuery.parseJSON('${propertylistjson}');
    var groupList=jQuery.parseJSON('${grouplistjson}');


    //加载分组
    function loadGroup(){
        var html='<option value="-1">请选择</option>';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadGroup.ac?pid=0',// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    html+='<option value="'+data[i].id+'">'+data[i].text+'</option>'
                }
                $("#groupList1").html(html);
                $("#groupList2").html(html);
                $("#groupList3").html(html);
                if(count==1){
                    $('#div_1').show();
                    $("#groupList1").val('${grouplist[0].id}');
                }else if(count==2){
                    $('#div_1').show();
                    $("#groupList1").val('${grouplist[0].id}');
                    $('#div_2').show();
                    $("#groupList2").val('${grouplist[1].id}');
                }else if(count==3){
                    $('#div_1').show();
                    $("#groupList1").val('${grouplist[0].id}');
                    $('#div_2').show();
                    $("#groupList2").val('${grouplist[1].id}');
                    $('#div_3').show();
                    $("#groupList3").val('${grouplist[2].id}');
                }
                for(var i=0;i<propertyList.length;i++){
                    for(var j=0;j<groupList.length;j++){
                        if(propertyList[i].pid==groupList[j].id){
                            loadChildGroup(propertyList[i].pid,(j+1),propertyList[i].selectId);
                            loadChildGroup2(propertyList[i].pid,(j+1),'');
                        }else{
                        }
                    }
                }
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    function addobj(){
        if (count == 3) {
            alert("最多添加3项规格");
            return;
        }else{
            count++;
            var display1 =$('#div_1').css('display');
            var display2 =$('#div_2').css('display');
            var display3 =$('#div_3').css('display');
                if(display1=='none'){
                    $('#div_1').show();
                }else if(display2=='none'){
                    $('#div_2').show();
                }else if(display3=='none'){
                    $('#div_3').show();
                }
        }
        $(".posminus-sel").on("click",function(){
            $(this).parent().remove();
        });
    }

    //
    function delobj(index){
        $('#div_'+index).attr("style","display:none");
        count--;
        loadTable();
    }


//根据分组加载子标签
    function showSecond(value,index){
        if(value!="-1"){
            loadChildGroup(value,index,'');
        }
    }

    //加载子分组
    function loadChildGroup(pid,index,selectId){
        var html='';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadGroup.ac?pid='+pid,// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                html+='  <li><select class="form-control m-b minesel" name="child'+index+'"  onchange="loadTable()"><option value="-1">请选择</option>';
                for(var i=0;i<data.length;i++){
                    if(selectId!=null&&selectId!=''&&selectId==data[i].id){
                        html+='<option value="'+data[i].id+'" selected>'+data[i].text+'</option>'
                    }else{
                        html+='<option value="'+data[i].id+'">'+data[i].text+'</option>'
                    }

                }
                  html+= '</select><span class="fa fa-minus-circle minussapn posminus-sel"></span></li>';
                if(selectId!=null&&selectId!=''){
                    $("#addtwo"+index).append(html);
                }else{
                    $("#addtwo"+index).html(html);
                    if(index==1){
                        html1=html;
                    }else if(index==2){
                        html2=html;
                    }else if(index==3){
                        html3=html;
                    }
                }
                $(".posminus-sel").on("click",function(){
                    $(this).parent().remove();
                });
                $(".secdsel li").hover(function(){
                    $(this).find(".posminus-sel").show();
                },function () {
                    $(this).find(".posminus-sel").hide();
                })
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    //加载子分组
    function loadChildGroup2(pid,index,selectId){
        var html='';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadGroup.ac?pid='+pid,// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                html+='  <li><select class="form-control m-b minesel" name="child'+index+'"  onchange="loadTable()"><option value="-1">请选择</option>';
                for(var i=0;i<data.length;i++){
                    if(selectId!=null&&selectId!=''&&selectId==data[i].id){
                        html+='<option value="'+data[i].id+'" selected>'+data[i].text+'</option>'
                    }else{
                        html+='<option value="'+data[i].id+'">'+data[i].text+'</option>'
                    }

                }
                html+= '</select><span class="fa fa-minus-circle minussapn posminus-sel"></span></li>';
                    if(index==1){
                        html1=html;
                    }else if(index==2){
                        html2=html;
                    }else if(index==3){
                        html3=html;
                    }
                $(".posminus-sel").on("click",function(){
                    $(this).parent().remove();
                });
                $(".secdsel li").hover(function(){
                    $(this).find(".posminus-sel").show();
                },function () {
                    $(this).find(".posminus-sel").hide();
                })
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }


    function addsel(index){
        if(index==1){
            $("#addtwo1").append(html1);
        }else if(index==2){
            $("#addtwo2").append(html2);
        }else if(index==3){
            $("#addtwo3").append(html3);
        }
        $(".posminus-sel").on("click",function(){
            $(this).parent().remove();
        });
        $(".secdsel li").hover(function(){
            $(this).find(".posminus-sel").show();
        },function () {
            $(this).find(".posminus-sel").hide();
        })
    }

    //新增属性模态窗口打开关闭
    function addoption(index,type){
        if(index==1){
            $("#groupType").val(index);
            $("#myModal4").modal('show')
        }else{
            var pid='';
            $("#groupType").val(index);
            if(type==1){
                pid=$("#groupList1").val();
            }else if(type==2){
                pid=$("#groupList2").val();
            }else if(type==3){
                pid=$("#groupList3").val();
            }
            if(pid=="-1"){
                alert("请先选择父目录");
            }else{
                $("#groupPid").val(pid);
                $("#myModal4").modal('show')
            }
        }

    }
    function closemodal(){
        var pid=$("#groupPid").val();
        var type=$("#groupType").val();
        var name=$("#groupName").val();
        if(name==null||name==""){
            alert("请填写属性名称");
        }else{
            $.ajax( {
                url:'${pageContext.request.contextPath}/mall/addGroup.ac?pid='+pid+'&type='+type+'&name='+name,// 跳转到 action
                type:'post',
                cache:false,
                dataType:'json',
                success:function(data) {
                    loadGroup();
                    $("#addtwo1").html("");
                    $("#addtwo2").html("");
                    $("#addtwo3").html("");
                    $("#myModal4").modal('hide')
                },
                error : function() {
                    alert("操作失败！");
                }
            });
        $("#myModal4").modal('hide')
        }
    }

    //加载表格
    function loadTable(){
        //判断3个父类是否选中
        var display1 =$('#div_1').css('display');
        var display2 =$('#div_2').css('display');
        var display3 =$('#div_3').css('display');
        var headName=new Array();
        if(display1!="none"){
            var headObj=new Object();
            headObj.id=$("#groupList1").val();
            headObj.text=$("#groupList1").find("option:selected").text();
                headName.push(headObj);
            array1=[];
            $("select[name='child1']").each(function(){
                var obj=new Object();
                obj.id=$(this).val();
                obj.text=$(this).find("option:selected").text();
                if(obj.id!='-1'){
                    array1.push(obj);
                }

            });
            //去重
            var result = [];
            for (var i = 0, len = array1.length; i < len; i++) {
                isRepeated = false;
                if(result.length==0){
                }else{
                for (var j = 0; j < result.length; j++) {
                    if (array1[i].id == result[j].id) {
                        isRepeated = true;
                        break;
                    }
                }
                }
                if (!isRepeated) {
                    result.push(array1[i]);
                }
            }
            array1=result;
        }else{
            array1=[];
        }
        if(display2!="none"){
            var headObj=new Object();
            headObj.id=$("#groupList2").val();
            headObj.text=$("#groupList2").find("option:selected").text();
                headName.push(headObj);
            array2=[];
            $("select[name='child2']").each(function(){
                var obj=new Object();
                obj.id=$(this).val();
                obj.text=$(this).find("option:selected").text();
                if(obj.id!='-1'){
                    array2.push(obj);
                }
            });
            //去重
            var result = [];
            for (var i = 0, len = array2.length; i < len; i++) {
                isRepeated = false;
                if(result.length==0){
                }else{
                    for (var j = 0; j < result.length; j++) {
                        if (array2[i].id == result[j].id) {
                            isRepeated = true;
                            break;
                        }
                    }
                }
                if (!isRepeated) {
                    result.push(array2[i]);
                }
            }
            array2=result;
        }else{
            array2=[];
        }
        if(display3!="none"){
            var headObj=new Object();
            headObj.id=$("#groupList3").val();
            headObj.text=$("#groupList3").find("option:selected").text();
                headName.push(headObj);
            array3=[];
            $("select[name='child3']").each(function(){
                var obj=new Object();
                obj.id=$(this).val();
                obj.text=$(this).find("option:selected").text();
                if(obj.id!='-1'){
                    array3.push(obj);
                }
            });
            //去重
            var result = [];
            for (var i = 0, len = array3.length; i < len; i++) {
                isRepeated = false;
                if(result.length==0){
                }else{
                    for (var j = 0; j < result.length; j++) {
                        if (array3[i].id == result[j].id) {
                            isRepeated = true;
                            break;
                        }
                    }
                }
                if (!isRepeated) {
                    result.push(array3[i]);
                }
            }
            array3=result;
        }else{
            array3=[];
        }

        //生成表头
        var html='';
        var num=0;
         html+='<thead>'+
            '                                    <tr>';
         for(var i=0;i<headName.length;i++){
         html+='<th>'+headName[i].text+'</th><input type="hidden" value="'+headName[i].id+'">'
         }
         html+='                                     <th>销售价(元)</th>'+
                 '                                     <th>进货价(元)</th>'+
            '                                        <th>库存</th>'+
            '                                        <th style="display: none">扫码编码</th>'+
            '                                    </tr>'+
            '                                    </thead>'+
            '                                    <tbody>';
        if(array1.length!=0){
            for(var a=0;a<array1.length;a++){
                if(array2.length!=0){
                    for(var b=0;b<array2.length;b++){
                         if(array3.length!=0){
                             for(var c=0;c<array3.length;c++){
                                 //1,2,3
                                 html+='<tr><td>'+array1[a].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId1" value="'+array1[a].id+'"/>'+
                                        '<td>'+array2[b].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId2" value="'+array2[b].id+'"/>'+
                                        '<td>'+array3[c].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId3" value="'+array3[c].id+'"/>'+
                                        '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                         '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                                        '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                                        '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                             }
                         }else{
                             //1,2
                             html+='<tr><td>'+array1[a].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId1" value="'+array1[a].id+'"/>'+
                                 '<td>'+array2[b].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId2" value="'+array2[b].id+'"/>'+
                                 '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                     '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                                 '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                                 '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                         }
                    }
                }else{
                    //1,3
                    if(array3.length!=0){
                        for(var c=0;c<array3.length;c++){
                            html+='<tr><td>'+array1[a].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId1" value="'+array1[a].id+'"/>'+
                                '<td>'+array3[c].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId3" value="'+array3[c].id+'"/>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                    '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                                '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                        }
                    }else{
                       // 1
                        html+='<tr><td>'+array1[a].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId1" value="'+array1[a].id+'"/>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                            '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                    }
                }
            }


        }else{
            if(array2.length!=0){
                for(var b=0;b<array2.length;b++){
                    if(array3.length!=0){
                        for(var c=0;c<array3.length;c++){
                            //2,3
                            html+='<tr><td>'+array2[b].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId2" value="'+array2[b].id+'"/>'+
                                '<td>'+array3[c].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId3" value="'+array3[c].id+'"/>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                    '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                                '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                        }
                    }else{
                        //2
                        html+='<tr><td>'+array2[b].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId2" value="'+array2[b].id+'"/>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                            '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                    }
                }
            }else{
                //3
                if(array3.length!=0){
                    for(var c=0;c<array3.length;c++){
                        html+='<tr><td>'+array3[c].text+'</td><input type="hidden" name="pwxgoods.stocklist['+num+'].typesId3" value="'+array3[c].id+'"/>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].price"></td>'+
                                '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].netPrice"></td>'+
                            '<td><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].stock"></td>'+
                            '<td style="display: none"><input type="text" class="form-control oowninputwd" name="pwxgoods.stocklist['+num+'].venderId"></td></tr>';
                    }
                }
            }
        }
         html+='                                    </tbody>';
$("#tableList").html(html);
    }

    
    //弹出商户编码
    function  showVenderId() {
        var name=encodeURI(encodeURI($("#venderName").val()));;

        var html='';
        $.ajax({
            url: "${pageContext.request.contextPath}/mall/showVenderId.ac?name="+name,
            async: false,
            success: function (data) {
                data = jQuery.parseJSON(data);
                    for(var i=0;i<data.length;i++){
                        html+='<tr><td>'+data[i].name+'</td>'+
                            '<td>'+data[i].telephone+'</td>'+
                            '<td>'+data[i].address+'</td>'+
                            '<td><button class="btn btn-primary" onclick="selectVenderId(\''+data[i].brand_code+'\',\''+data[i].name+'\',\''+data[i].address+'\')">选择</button></td></tr>';
                    }
                    $("#venderIdList").html(html);
                    $("#myModa").modal('show');
            }
        });

    }

    function selectVenderId(id,name,addr){
        $("#pwxgoods_venderIdMain").val(id);
        $("#venderIdName").val(name);
        $("#myModa").modal('hide');
    }

    //新增删除上传图片数量
    $(".posminus").on("click",function(){
        $(this).parent().remove();
    });
    function picsplus() {
    }
    /*$(".picsplus").click(function()*/
    function picsplus(){
        var datetime = new Date();
        var fulltime = datetime.getTime();
        var html='<li>'+
                ' <a href="javascript:" class="upload_pic" style="height:80px;"><input type="file" name="fileToUpload" id="fileToUpload'+fulltime+'" onChange="uploadFile(\'fileToUpload'+fulltime+'\',\'imgUpdate'+fulltime+'\',\'shopPicId'+fulltime+'\');">'+
                '    <img  id="imgUpdate'+fulltime+'" src="${OSSURL}/common/plus_72.png" width="100%"/>'+
                '    <input type="hidden" id="shopPicId'+fulltime+'" name="pwxgoods.goodsPicId">'+
                '</a>'+
                '<i class="fa fa-minus-circle minussapn posminus" onclick="delpic(this);"></i>'+
            '</li>';
        $(".picClass").append(html);
        $(".posminus").on("click",function(){
            $(this).parent().remove();
        });

        $(".addpicsul li").hover(function(){
            $(this).find(".posminus ").show();
        },function () {
            $(this).find(".posminus ").hide();
        })
    }

    //新增规格
//    plussin = '<div class="singleobj"><div class="level_1 clear"><div class="onecup"><select class="form-control m-b minesel" name="account"><option>点击选择</option></select><span class="fa fa-minus-circle minussapn delcurobj posdelall" onclick="delobj();"></span></div><span class="newplussapn" onclick="addoption();">新增</span></div>'

    $("#ck").click(function () {
        if ($(this).is(":checked")) {
            $(".picsup").show();
        }
        else {
            $(".picsup").hide();
        }
    })

    function delpic(obj){
        $(obj).parent().remove();
    }
</script>


    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name);

    <!-- 实例化编辑器 -->
    var ue = UE.getEditor('container');
    <!-- 自定义上传图片-->
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        if (action == 'uploadimage' || action == 'uploadfile') {
            return '${ctx}/ue/uploadImageForUE.ac';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    };
    var picPath='<%=ConfigUtil.get("OSSURL")%>';
    var id='${id}';
    //对编辑器的操作最好在编辑器ready之后再做
    ue.ready(function() {
        //设置编辑器的内容
        ue.setContent('');
        //获取html内容，返回: <p>hello</p>
        var html = ue.getContent();
        //获取纯文本内容，返回: hello
        var txt = ue.getContentTxt();
      /*  if(id!=null&&id!=''&&id!=undefined)//如果是编辑，读取数据
        {
            loadForEdit(id);
        }*/
        var page_type='${page_type}';
        if(page_type=='update'){
        ue.setContent('${info}');
        }

    });

        loadGroup();
   loadGoodsGroup()
    loadUnit();
    loadBrand();
    $("#pwxgoods_isTicket").val('${twxgoods.isTicket}');
    $("#pwxgoods_isTicket").trigger("chosen:updated");
    $("#pwxgoods_isRecommend").val('${twxgoods.isRecommend}');
    $("#pwxgoods_isRecommend").trigger("chosen:updated");
    //加载分组
    function loadGoodsGroup(){
        var html='<option value="">请选择</option>';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadGroupInfo.ac',// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    html+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                }
                $("#pwxgoods_groupId").html(html);
                $("#pwxgoods_groupId").val('${twxgoods.groupId}');
                $("#pwxgoods_groupId").trigger("chosen:updated");
                loadTag('${twxgoods.groupId}',0);
                //行业二级联动
                $("#pwxgoods_groupId").chosen().change(function () {
                    loadTag(this.value,1);
                });
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    //加载单位
    function loadUnit(){
        var html='<option value="">请选择</option>';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadUnit.ac',// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    html+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                }
                $("#pwxgoods_unitId").html(html);
                $("#pwxgoods_unitId").val('${twxgoods.unitId}');
                $("#pwxgoods_unitId").trigger("chosen:updated");

            },
            error : function() {
                alert("操作失败！");
            }
        });
    }
    //加载标签
    function loadTag(pid,isEdit){
        var html='<option value="">请选择</option>';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadTag.ac?pid='+pid,// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    html+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                }
                $("#pwxgoods_tags").html(html);
                $("#pwxgoods_tags").trigger("chosen:updated");
                if(0==isEdit){
                chose_mult_set_ini("#pwxgoods_tags",'${twxgoods.tags}');
                }

            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    // 多选 select 数据初始化
    function chose_mult_set_ini(select, values) {
        var arr = values.split(',');
        var length = arr.length;
        var value = '';
        for (i = 0; i < length; i++) {
            value = arr[i];
            $(select + " option[value='" + value + "']").attr('selected', 'selected');
        }
        $(select).trigger("chosen:updated");
    }
    //加载品牌
    function loadBrand(){
        var html='<option value="">请选择</option>';
        $.ajax( {
            url:'${pageContext.request.contextPath}/mall/loadBrand.ac',// 跳转到 action
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    html+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                }
                $("#pwxgoods_brand").html(html);

                $("#pwxgoods_brand").val('${twxgoods.brand}');
                $("#pwxgoods_brand").trigger("chosen:updated");
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    //关闭iframe
    $('#btn_close').click(function(){
        parent.layer.close(index);
    });
    //关闭iframe
    $('#btn_close1').click(function(){
        parent.layer.close(index);
    });





    function doSubmit()//提交保存
    {

        var name=$("#pwxgoods_name").val();//名称
        var shopPicIdCover=$("#shopPicIdCover").val();//封面图片
        var shopPicId=$("#shopPicId1").val();//商品图片
        var intPro=$("#pwxgoods_intPro").val();
        var infoLite=$("#pwxgoods_infoLite").val();//商品简介
        var tags=$("#pwxgoods_tags").val();
        var container=ue.getContent();//编辑框内容
        $("#pwxgoods_info").val(container);
        var isOk=true;
        if(name==null||name==undefined||name==''){alert("请输入商品名");isOk= false;}
        if($("#hid_page_type").val() != 'update'){
            if(shopPicId==null||shopPicId==undefined||shopPicId==''){alert("请上传商品图片");isOk= false;}
        }
        if(shopPicIdCover==null||shopPicIdCover==undefined||shopPicIdCover==''){alert("请上传封面图");isOk= false;}
        if(intPro==null||intPro==undefined||intPro==''){alert("请输入返积分比例");isOk= false;}
        if(tags==null||tags==undefined||tags==''){alert("请选择标签");isOk= false;}
        if(isOk){
            $.ajax( {
                url:'${pageContext.request.contextPath}/mall/doSave.ac',// 跳转到 action
                data:$("#form_brand").serialize(),
                type:'post',
                cache:false,
                dataType:'json',
                success:function(data) {

                    if(data.isok!="no")
                    {
                        alert(data.msg);
                        parent.layer.close(index);

//                        $(parent).find("iframe[src$='/toMall_lm']").reloadTable();
//                        parent.frames["iframe26"].reloadTable();
                    }else
                    {
                        alert(data.msg);
                    }
                },
                error : function() {
                    alert("操作失败！");
                }
            });
        }else
        {return false;}
    }

   // var picPath='http://9900oss.oss-cn-hangzhou.aliyuncs.com/';

    function uploadFile(obj,id,picId){//上传图片
        var labid = "";
        //var detailId = $("#detailId").val();
        //$("#"+id).css("background","url(${pageContext.request.contextPath}/resources/assets/images/waiting.gif) no-repeat 0 0/100% 100%");
        $.ajaxFileUpload({
            url: '${pageContext.request.contextPath}/common/doUploadFile.ac',
            secureuri: false,
            type:'post',
            fileElementId: obj,
            dataType: 'text',
            success: function(data, status) {

                var img=JSON.parse(data);
                $("#"+id).attr("src",picPath+img.path);
                $("#"+picId).val(img.picId);

            },
            error: function(data, status, e) {
                alert(e);
            }
        });
    }
    
    
    function checkNumber(obj) {
        var reg=/^[0-9]{1,}(?:.[0-9]{0,2})?$/;

        if(!reg.test(obj.value))
        {
            alert("请正确输入数字,且保留小数点后2位");
            obj.value="0.0";
        }
    }
</script>
<script>
    $(".onecup").hover(function(){
        $(this).find(".posdelall ").show();
    },function () {
        $(this).find(".posdelall ").hide();
    })
    $(".addpicsul li").hover(function(){
        $(this).find(".posminus ").show();
    },function () {
        $(this).find(".posminus ").hide();
    })
</script>

</html>

